package com.tddx.activiti.base;

import java.io.Serializable;
import java.util.Date;

import org.apache.log4j.Logger;
import org.apache.shiro.authz.UnauthorizedException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.ModelAttribute;

import com.tddx.activiti.common.propertyeditor.DateEditorSupport;

public abstract class BaseController<T extends BaseEntity, ID extends Serializable>{

	protected Logger log = Logger.getLogger(this.getClass());
	
	@ModelAttribute
	public void setAtrribute(){
		log.info("---装载controller属性开始------");
		log.info("---装载controller属性结束------");
	}


	
	/**
	 * 没有权限
	 */
	@ExceptionHandler({UnauthorizedException.class})
    public String UnauthorizedException() {
        return "modules/erro/403";
    }
	
	/**
	 * 初始化日期
	 * @author zhaoyanwei
	 * @param dataBinder
	 */
	@InitBinder
	public void InitBinder(WebDataBinder dataBinder) {
		dataBinder.registerCustomEditor(Date.class, new DateEditorSupport());
	}
	
}